package com.qianyu.project.mapper.provider;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qianyu.project.entity.ProjectInfo;
import com.qianyu.project.entity.ProviderInfo;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.ObjectUtils;

import java.util.Map;

/**
 * author wyh
 * Date 2021/2/3
 **/
public class ProviderInfoProvider {
    public String WyhCreatedList(IPage<ProviderInfo> page, Map<String, String> params){
        return new SQL(){
            {
                SELECT("pi.*,pt.provider_name");
                FROM("provider_info pi,provider_type pt");
                WHERE("pt.id=pi.type");
                if(!ObjectUtils.isEmpty(params.get("type"))){
                    WHERE("pi.type = '"+params.get("type")+"'");
                }
                if(!ObjectUtils.isEmpty(params.get("providerName"))){
                    WHERE("pi.provider_name like '%"+params.get("providerName")+"%'");
                }
            }
        }.toString();
    }
}
